<?php

use app\common\enum\DeliveryType as DeliveryTypeEnum;

// 订单详情
$detail = isset($detail) ? $detail : null;

?>
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget__order-detail widget-body am-margin-bottom-lg">

                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">订单信息</div>
                    </div>
                    <div class="am-scrollable-horizontal">
                        <table class="regional-table am-table am-table-bordered am-table-centered am-text-nowrap am-margin-bottom-xs">
                            <tbody>
                                <tr>
                                    <th>订单号</th>
                                    <th>交易号</th>


                                    <th>订单状态</th>
                                </tr>
                                <?php foreach ($detail as $order): ?>
                                    <tr>
                                        <td><?= $order['order_no'] ?></td>
                                        <td><?= $order['transaction_no'] ?></td>
                                        <td class="am-text-middle">
                                            <p>订单状态：
                                                <span class="am-badge am-badge-warning">
                                                    <?php
                                                    if( $order['order_status'] == 200 ){
                                                        echo '已支付 待核销';
                                                    } else if( $order['order_status'] == 201 ){
                                                        echo '已取消';
                                                    } else if( $order['order_status'] == 300 ){
                                                        echo '已核销 待确认';
                                                    } else if( $order['order_status'] == 400 ){
                                                        echo '已确认 待评价';
                                                    } else if( $order['order_status'] == 500 ){
                                                        echo '已完成';
                                                    } else if( $order['order_status'] == 600 ){
                                                        echo '已评价 待完成';
                                                    } else if( $order['order_status'] == 800 ){
                                                        echo '已结束';
                                                    }
                                                    ?>
                                                </span>
                                            </p>
                                        </td>
                                    </tr>
                                <?php endforeach;?>
                            </tbody>
                        </table>
                    </div>

                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">门票信息</div>
                    </div>
                    <div class="am-scrollable-horizontal">
                        <table class="regional-table am-table am-table-bordered am-table-centered am-text-nowrap am-margin-bottom-xs">
                            <tbody>
                                <tr>
                                    <th>票名</th>
                                    <th>价格</th>
                                    <th>推荐</th>
                                    <th>单价</th>
                                    <th>购买数量</th>
                                    <th>商品描述</th>
                                </tr>
                                <?php foreach ($detail as $order): ?>
                                    <tr>
                                        <td><?= $order['name']?>(<?= $order['type'] == 1 ? '单票' : '套票'?>)</td>
                                        <td><?= $order['price']?></td>
                                        <td><?= $order['recommend']?></td>
                                        <td>￥<?= $order['article_price'] ?></td>
                                        <td>×<?= $order['num'] ?>(张)</td>
                                        <td><?= $order['content']?></td>
                                    </tr>
                                <?php endforeach;?>
                            </tbody>
                        </table>
                    </div>

                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">用户信息</div>
                    </div>
                    <div class="am-scrollable-horizontal">
                        <table class="regional-table am-table am-table-bordered am-table-centered am-text-nowrap am-margin-bottom-xs">
                            <tbody>
                            <tr>
                                <th>微信头像</th>
                                <th>微信昵称</th>
                                <th>性别</th>
                                <th>国家</th>
                                <th>实际消费的金额</th>
                            </tr>
                            <?php foreach ($detail as $order): ?>
                                <tr>
                                    <td>
                                        <img src="<?= $order['avatarUrl'] ?>" alt="">
                                    </td>
                                    <td>
                                        <?= $order['nickName'] ?>
                                        <p class="am-link-muted">(用户id：<?= $order['user_id'] ?>)</p>
                                    </td>
                                    <td><?= $order['gender'] == 1 ? '男' : '女' ?></td>
                                    <td><?= $order['province']?>/<?= $order['city']?></td>
                                    <td>￥<?= $order['expend_money'] ?></td>
                                </tr>
                            <?php endforeach;?>
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
